#ifndef ROOM_MANAGER_HPP
#define ROOM_MANAGER_HPP

#include <string>
#include <unordered_map>
#include <set>
#include <mutex>

class RoomManager {
public:
    bool join_room(int fd, const std::string& room_name, const std::string& pwd);
    void leave_room(int fd);
    std::string get_room(int fd);
    std::string list_members(const std::string& room_name);
    std::set<int> get_room_members(const std::string& room_name);

private:
    std::mutex mtx;
    std::unordered_map<int, std::string> user_rooms;
    std::unordered_map<std::string, std::set<int>> rooms;
    std::unordered_map<std::string, std::string> room_passwords;
};

extern RoomManager room_manager;

#endif // ROOM_MANAGER_HPP

